package com.example.demo.entity;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "tb_blog", schema = "db_blog")
public class TbBlogEntity {
    private int blogId;
    private String blogTitle;
    private String blogContent;
    private Timestamp blogDatetime;
    private int blogUp;
    private int blogViewnum;
    private String tagName;

    @Id
    @Column(name = "blog_id")
    public int getBlogId() {
        return blogId;
    }

    public void setBlogId(int blogId) {
        this.blogId = blogId;
    }

    @Basic
    @Column(name = "blog_title")
    public String getBlogTitle() {
        return blogTitle;
    }

    public void setBlogTitle(String blogTitle) {
        this.blogTitle = blogTitle;
    }

    @Basic
    @Column(name = "blog_content")
    public String getBlogContent() {
        return blogContent;
    }

    public void setBlogContent(String blogContent) {
        this.blogContent = blogContent;
    }

    @Basic
    @Column(name = "blog_datetime")
    public Timestamp getBlogDatetime() {
        return blogDatetime;
    }

    public void setBlogDatetime(Timestamp blogDatetime) {
        this.blogDatetime = blogDatetime;
    }

    @Basic
    @Column(name = "blog_up")
    public int getBlogUp() {
        return blogUp;
    }

    public void setBlogUp(int blogUp) {
        this.blogUp = blogUp;
    }

    @Basic
    @Column(name = "blog_viewnum")
    public int getBlogViewnum() {
        return blogViewnum;
    }

    public void setBlogViewnum(int blogViewnum) {
        this.blogViewnum = blogViewnum;
    }

    @Basic
    @Column(name = "tag_name")
    public String getTagName() {
        return tagName;
    }

    public void setTagName(String tagName) {
        this.tagName = tagName;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TbBlogEntity that = (TbBlogEntity) o;
        return blogId == that.blogId &&
                blogUp == that.blogUp &&
                blogViewnum == that.blogViewnum &&
                Objects.equals(blogTitle, that.blogTitle) &&
                Objects.equals(blogContent, that.blogContent) &&
                Objects.equals(blogDatetime, that.blogDatetime) &&
                Objects.equals(tagName, that.tagName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(blogId, blogTitle, blogContent, blogDatetime, blogUp, blogViewnum, tagName);
    }
}
